home *** CD-ROM | disk | FTP | other *** search
-
- #include "psm.h"
-
- /**
- ** Definition of examine window
- **/
-
- enum {
-
- WINTAGS_ID = 1,
-
- TITLE_ID,
- PUBNAME_ID,
-
- WINLIST_ID,
- LEFT_ID,
- TOP_ID,
- WIDTH_ID,
- HEIGHT_ID,
-
- TYPE_ID,
- AUTOSCROLL_ID,
- FONTNAME_ID,
- FONTSIZE_ID,
- };
-
- static ULONG __saveds __interrupt
- examine_handler(struct GadOutline *go, ULONG command, struct GOIMsg *msg);
-
- static ULONG examine_outline[] = {
-
- GO_OUTLINETAGS(0,0),
- TAG_END,
- GOA_BaseName, (ULONG)&__BaseName[0],
- GOA_SetUserHandler, (ULONG)&examine_handler,
- GOA_SetTransHookData, NULL,
- GOA_ClearFullWin, TRUE,
- GOA_ErrorReportLevel,
- (1L<<GOTYPE_FINE) | (1L<<GOTYPE_FINE2)
- | (1L<<GOTYPE_NOTE) | (1L<<GOTYPE_NOTE2)
- | (1L<<GOTYPE_WARN) | (1L<<GOTYPE_WARN2)
- | (1L<<GOTYPE_ALERT) | (1L<<GOTYPE_ALERT2) | (1L<<GOTYPE_ALERT3)
- | (1L<<GOTYPE_FAIL) | (1L<<GOTYPE_FAIL2) | (1L<<GOTYPE_FAIL3),
- TAG_END,
-
- GO_WINDOWTAGS(0,WINTAGS_ID),
- TAG_END,
- WA_Title, (ULONG)&"Examine Screen", //(ULONG)&__ShortTitle[0],
- WA_ScreenTitle, (ULONG)&__LongTitle[0],
- WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_REFRESHWINDOW,
- WA_Activate, TRUE,
- WA_CloseGadget, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_SizeGadget, TRUE,
- WA_SizeBBottom, TRUE,
- WA_SimpleRefresh, TRUE,
- WA_BackFill, NULL,
- TAG_END,
-
- GO_COMMANDTAGS(0,0),
- TAG_END,
- GOCT_SetHotKey, 0,
- TAG_END,
-
- GO_VDRAWGRP(0,0,1),
- GOCT_SizeSpaceAbove, GO_TSIZE(GOM_PadSet,80,GOT_PercCharH),
- GOCT_SizeSpaceBelow, GO_TSIZE(GOM_PadSet,80,GOT_PercCharH),
- GOCT_SizeSpaceLeft, GO_TSIZE(GOM_PadSet,80,GOT_PercCharW),
- GOCT_SizeSpaceRight, GO_TSIZE(GOM_PadSet,80,GOT_PercCharW),
- TAG_END,
- GODT_DrawStdFrame, GO_SCLPNT(SHADOWPEN,0,0,63,63),
- TAG_END,
-
- GO_VDRAWGRP(0,0,0),
- GOCT_SizeSpaceAbove, GO_TSIZE(GOM_PadSet,50,GOT_PercCharH),
- GOCT_SizeSpaceBelow, GO_TSIZE(GOM_PadSet,50,GOT_PercCharH),
- GOCT_SizeSpaceLeft, GO_TSIZE(GOM_PadSet,50,GOT_PercCharW),
- GOCT_SizeSpaceRight, GO_TSIZE(GOM_PadSet,50,GOT_PercCharW),
- TAG_END,
- GODT_DrawStdFrame, GO_SCLPNT(SHADOWPEN,0,0,63,63),
- TAG_END,
-
- /**
- GO_DRAWBOX(0,DEFTITLE_ID,1),
- GOCT_TextPtrTag, GODT_DrawHighText,
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxW),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdAdd,500,GOT_PercCharW),
- TAG_END,
- GODT_BodyTextPtr, (ULONG)&"",
- GODT_SetTextMode, TXTMD_LEFT | TXTMD_ENDRIGHT | TXTMD_RELTOP,
- GODT_MoveTo, GO_SCLPNT(0,0,0,0,0),
- GODT_DrawHighText, (ULONG)&"Name: ",
- GODT_DrawStdTextTag, GODT_BodyTextPtr,
- TAG_END,
- **/
-
- GO_DRAWBOX(GOSD_Normal,0,PUBNAME_ID,1),
- GOCT_TextPtrTag, GODT_DrawHighText,
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxW),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdAdd,500,GOT_PercCharW),
- TAG_END,
- GODT_BodyTextPtr, (ULONG)&"",
- GODT_SetTextMode, FLGALL(TXTMD_LEFT | TXTMD_ENDRIGHT | TXTMD_RELTOP),
- GODT_MoveTo, GO_SCLPNT(0,0,0,0,0),
- GODT_DrawHighText, (ULONG)&"Public Name: ",
- GODT_DrawStdTextTag, GODT_BodyTextPtr,
- TAG_END,
-
- GO_DRAWBOX(GOSD_Normal,0,TITLE_ID,1),
- GOCT_TextPtrTag, GODT_DrawHighText,
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxW),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdAdd,500,GOT_PercCharW),
- TAG_END,
- GODT_BodyTextPtr, (ULONG)&"",
- GODT_SetTextMode, FLGALL(TXTMD_LEFT | TXTMD_ENDRIGHT | TXTMD_RELTOP),
- GODT_MoveTo, GO_SCLPNT(0,0,0,0,0),
- GODT_DrawHighText, (ULONG)&"Title: ",
- GODT_DrawStdTextTag, GODT_BodyTextPtr,
- TAG_END,
-
- GO_ENDGRP(),
-
- //GO_EMPTYBOX(0,0,0), TAG_END,
-
- GO_GTBOX(LISTVIEW_KIND, 0, WINLIST_ID, 1,
- (ULONG)&"Windows", PLACETEXT_ABOVE|NG_HIGHLABEL),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdMax,500,GOT_PercCharH),
- GOCT_SizeUser1, GO_TSIZE(GOM_VarSet,200,GOT_PercCharW),
- GOCT_CopyUser1ToTag, GTLV_ScrollWidth,
- TAG_END,
- GTLV_ReadOnly, TRUE,
- GTLV_Labels, NULL,
- GTLV_ScrollWidth, 16,
- GT_Underscore, '_',
- GA_Disabled, FALSE,
- TAG_END,
-
- GO_VDRAWGRP(0,0,0),
- GOCT_FitToGroup, TRUE,
- GOCT_SizeSpaceAbove, GO_TSIZE(GOM_PadSet,50,GOT_PercCharH),
- GOCT_SizeSpaceBelow, GO_TSIZE(GOM_PadSet,50,GOT_PercCharH),
- GOCT_SizeSpaceLeft, GO_TSIZE(GOM_PadSet,50,GOT_PercCharW),
- GOCT_SizeSpaceRight, GO_TSIZE(GOM_PadSet,50,GOT_PercCharW),
- TAG_END,
- GODT_DrawStdFrame, GO_SCLPNT(SHADOWPEN,0,0,63,63),
- TAG_END,
-
- GO_HORIZGRP(0,0,1), TAG_END,
-
- GO_VERTGRP(0,0,1), TAG_END,
-
- GO_GTBOX(NUMBER_KIND, 0, LEFT_ID, 1,
- (ULONG)&"Left: ", PLACETEXT_LEFT|NG_HIGHLABEL),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,400,GOT_PercChar0),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercCharH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- TAG_END,
- GTNM_Number, 0,
- GA_Disabled, FALSE,
- TAG_END,
-
- GO_GTBOX(NUMBER_KIND, 0, TOP_ID, 1,
- (ULONG)&"Top: ", PLACETEXT_LEFT|NG_HIGHLABEL),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,400,GOT_PercChar0),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercCharH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- TAG_END,
- GTNM_Number, 0,
- GA_Disabled, FALSE,
- TAG_END,
-
- GO_ENDGRP(),
-
- GO_VERTGRP(0,0,1), TAG_END,
-
- GO_GTBOX(NUMBER_KIND, 0, WIDTH_ID, 1,
- (ULONG)&"Width: ", PLACETEXT_LEFT|NG_HIGHLABEL),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,400,GOT_PercChar0),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercCharH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- TAG_END,
- GTNM_Number, 0,
- GA_Disabled, FALSE,
- TAG_END,
-
- GO_GTBOX(NUMBER_KIND, 0, HEIGHT_ID, 1,
- (ULONG)&"Height: ", PLACETEXT_LEFT|NG_HIGHLABEL),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,400,GOT_PercChar0),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercCharH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- TAG_END,
- GTNM_Number, 0,
- GA_Disabled, FALSE,
- TAG_END,
-
- GO_ENDGRP(),
-
- GO_ENDGRP(),
-
- GO_ENDGRP(),
-
- GO_EMPTYBOX(0,0,0), TAG_END,
-
- GO_VDRAWGRP(0,0,0),
- GOCT_SizeSpaceAbove, GO_TSIZE(GOM_PadSet,50,GOT_PercCharH),
- GOCT_SizeSpaceBelow, GO_TSIZE(GOM_PadSet,50,GOT_PercCharH),
- GOCT_SizeSpaceLeft, GO_TSIZE(GOM_PadSet,50,GOT_PercCharW),
- GOCT_SizeSpaceRight, GO_TSIZE(GOM_PadSet,50,GOT_PercCharW),
- TAG_END,
- GODT_DrawStdFrame, GO_SCLPNT(SHADOWPEN,0,0,63,63),
- TAG_END,
-
- GO_HORIZGRP(0,0,1), TAG_END,
-
- GO_DRAWBOX(GOSD_Normal,0,TYPE_ID,1),
- GOCT_TextPtrTag, GODT_DrawHighText,
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxW),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdAdd,500,GOT_PercCharW),
- TAG_END,
- GODT_BodyTextPtr, (ULONG)&"",
- GODT_SetTextMode, FLGALL(TXTMD_LEFT | TXTMD_ENDRIGHT | TXTMD_RELTOP),
- GODT_MoveTo, GO_SCLPNT(0,0,0,0,0),
- GODT_DrawHighText, (ULONG)&"Type: ",
- GODT_DrawStdTextTag, GODT_BodyTextPtr,
- TAG_END,
-
- GO_DRAWBOX(GOSD_Normal,0,AUTOSCROLL_ID,0),
- GOCT_TextPtrTag, GODT_DrawHighText,
- GOCT_MoreTextPtrTag, GODT_BodyTextPtr,
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,100,GOT_PercTextAddW),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxH),
- TAG_END,
- GODT_BodyTextPtr, (ULONG)&"",
- GODT_SetTextMode, FLGALL(TXTMD_LEFT | TXTMD_ENDRIGHT | TXTMD_RELTOP),
- GODT_MoveTo, GO_SCLPNT(0,0,0,0,0),
- GODT_DrawHighText, (ULONG)&" Autoscroll: ",
- GODT_DrawStdTextTag, GODT_BodyTextPtr,
- TAG_END,
-
- GO_ENDGRP(),
-
- GO_HORIZGRP(0,0,1), TAG_END,
-
- GO_DRAWBOX(GOSD_Normal,0,FONTNAME_ID,1),
- GOCT_TextPtrTag, GODT_DrawHighText,
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxW),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercTextMaxH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdAdd,500,GOT_PercCharW),
- TAG_END,
- GODT_BodyTextPtr, (ULONG)&"",
- GODT_SetTextMode, FLGALL(TXTMD_LEFT | TXTMD_ENDRIGHT | TXTMD_RELTOP),
- GODT_MoveTo, GO_SCLPNT(0,0,0,0,0),
- GODT_DrawHighText, (ULONG)&"Font: ",
- GODT_DrawStdTextTag, GODT_BodyTextPtr,
- TAG_END,
-
- GO_GTBOX(NUMBER_KIND, 0, FONTSIZE_ID, 0,
- (ULONG)&"Size: ", PLACETEXT_LEFT|NG_HIGHLABEL),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_StdSet,300,GOT_PercChar0),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_StdSet,100,GOT_PercCharH),
- GOCT_SizeBodyWidth, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- GOCT_SizeBodyHeight, GO_TSIZE(GOM_PadSet,0,GOT_Pixels),
- TAG_END,
- GTNM_Number, 0,
- GA_Disabled, FALSE,
- TAG_END,
-
- GO_ENDGRP(),
-
- GO_ENDGRP(),
-
- GO_ENDGRP(),
-
- GO_ENDOUTLINE()
- };
-
- /**
- ** Handler for examine window
- **/
-
- #define TEXT_LEN 256
-
- struct examine_globals {
- struct List window_list; // List of windows
- struct Hook bf_hook;
-
- UBYTE title_text[TEXT_LEN]; // screen's title
- UBYTE pubname_text[TEXT_LEN]; // screen's public name
- UBYTE font_text[40]; // screen's font name
- };
-
- struct window_entry {
- struct Node node; // ln_Name points to &title[0]
- UBYTE title[1]; // rest of structure is title.
- };
-
- static ULONG __saveds __interrupt
- examine_handler(struct GadOutline *go, ULONG command, struct GOIMsg *msg)
- {
- struct examine_globals *gl;
- struct Gadget *gadget;
- ULONG class;
- UWORD code;
- UWORD qual;
-
- if(go == NULL) return HNDRES_CLOSEWIN;
-
- if( !(gl = (struct examine_globals *)go->go_UserData) ) {
- return HNDRES_CLOSEWIN;
- }
-
- if(command == HNDCMD_IDCMPMSG) {
- if( msg ) {
- class = msg->StdIMsg.Class;
- code = msg->StdIMsg.Code;
- qual = msg->StdIMsg.Qualifier;
- gadget = (struct Gadget *)msg->StdIMsg.IAddress;
- } else {
- return HNDRES_CLOSEWIN;
- }
- } else if(command == HNDCMD_SHUTDOWN) {
- if(go == (struct GadOutline *)msg) {
- DestroyExamine(go);
- }
- return HNDRES_NORMAL;
- } else if(command == HNDCMD_MOVEWIN) {
- if(msg) {
- UnlockGadOutline(go); // Window must be unlocked.
- if( !GO_OpenWindow(go,
- WA_CustomScreen, (struct Window *)msg,
- TAG_END) ) {
- return HNDRES_CLOSEWIN;
- }
- return HNDRES_NORMAL;
- } else return HNDRES_CLOSEWIN;
- } else if(command == HNDCMD_HIDEWIN) {
- UnlockGadOutline(go); // Window must be unlocked.
- GO_CloseWindow(go);
- return HNDRES_NORMAL;
- } else if(command == HNDCMD_LOCK) {
- LockGadOutline(go);
- return HNDRES_NORMAL;
- } else if(command == HNDCMD_UNLOCK) {
- UnlockGadOutline(go);
- return HNDRES_NORMAL;
- } else {
- return HNDRES_NORMAL;
- }
-
- switch (class) {
-
- case IDCMP_CLOSEWINDOW:
- {
- return HNDRES_CLOSEWIN;
- } break;
-
- case IDCMP_REFRESHWINDOW:
- {
- GO_BeginRefresh(go);
- GO_EndRefresh(go, TRUE);
- } break;
-
- }
-
- return HNDRES_NORMAL;
- }
-
- void DestroyExamine(struct GadOutline *go)
- {
- struct examine_globals *gl;
- struct Node *curnode;
-
- if(!go) return;
- gl = go->go_UserData;
-
- UnlockGadOutline(go); // Window must be unlocked.
- FreeGadOutline(go);
-
- if(gl) {
-
- // Free list of windows.
- while( (curnode = RemTail(&gl->window_list)) != NULL ) {
- FreeVec(curnode);
- }
-
- // Free global variables.
- FreeVec(gl);
- }
- }
-
- struct GadOutline *CreateExamine(struct GadOutline *par_go,
- UBYTE *name,struct Screen *scrn)
- {
- struct GadOutline *go;
- struct examine_globals *gl;
-
- if(!par_go || !par_go->go_Window) return NULL;
-
- go = AllocGadOutline(&examine_outline[0],
- GOA_OutlineSize, sizeof(examine_outline),
- GOA_UserIDCMP, par_go->go_MsgPort,
- TAG_END);
- if(!go) return NULL;
-
- gl = AllocVec(sizeof(struct examine_globals),MEMF_PUBLIC|MEMF_CLEAR);
- if(!gl) {
- DestroyExamine(go);
- return NULL;
- }
-
- NewList(&gl->window_list);
- go->go_UserData = gl;
-
- SetupBackFillHook(&gl->bf_hook,go);
- GO_SetObjAttrs(go,WINTAGS_ID,0,WA_BackFill,&gl->bf_hook,TAG_END);
-
- strncpy(&gl->title_text[0],scrn->DefaultTitle,TEXT_LEN-2);
- strncpy(&gl->pubname_text[0],name,TEXT_LEN-2);
- if(scrn->Font) {
- strncpy(&gl->font_text[0],scrn->Font->ta_Name,36);
- } else {
- strncpy(&gl->font_text[0],"- None -",36);
- }
-
- Forbid();
- {
- struct Window *win = scrn->FirstWindow;
- struct window_entry *win_node;
- UBYTE *title;
-
- while(win) {
- if( !(title = win->Title) ) title = "- None -";
- if(win_node = AllocVec(sizeof(struct window_entry)+strlen(title)+5,
- MEMF_CLEAR|MEMF_PUBLIC)) {
- strcpy(&win_node->title[0],title);
- win_node->node.ln_Name = &win_node->title[0];
- AddTail(&gl->window_list,&win_node->node);
- }
- win = win->NextWindow;
- }
- }
- Permit();
-
- GO_SetObjAttrs(go,TITLE_ID,0, GODT_BodyTextPtr,&gl->title_text[0],TAG_END);
- GO_SetObjAttrs(go,PUBNAME_ID,0, GODT_BodyTextPtr,&gl->pubname_text[0],TAG_END);
-
- GO_SetObjAttrs(go,WINLIST_ID,0, GTLV_Labels,&gl->window_list,TAG_END);
- GO_SetObjAttrs(go,LEFT_ID,0, GTNM_Number,scrn->LeftEdge,TAG_END);
- GO_SetObjAttrs(go,TOP_ID,0, GTNM_Number,scrn->TopEdge,TAG_END);
- GO_SetObjAttrs(go,WIDTH_ID,0, GTNM_Number,scrn->Width,TAG_END);
- GO_SetObjAttrs(go,HEIGHT_ID,0, GTNM_Number,scrn->Height,TAG_END);
-
- if( (scrn->Flags&SCREENTYPE) == WBENCHSCREEN ) {
- GO_SetObjAttrs(go,TYPE_ID,0, GODT_BodyTextPtr,"Workbench",TAG_END);
- } else if( (scrn->Flags&SCREENTYPE) == PUBLICSCREEN ) {
- GO_SetObjAttrs(go,TYPE_ID,0, GODT_BodyTextPtr,"Public",TAG_END);
- } else if( (scrn->Flags&SCREENTYPE) == CUSTOMSCREEN ) {
- GO_SetObjAttrs(go,TYPE_ID,0, GODT_BodyTextPtr,"Custom",TAG_END);
- } else {
- GO_SetObjAttrs(go,TYPE_ID,0, GODT_BodyTextPtr,"Unknown",TAG_END);
- }
-
- if( (scrn->Flags&AUTOSCROLL) ) {
- GO_SetObjAttrs(go,AUTOSCROLL_ID,0, GODT_BodyTextPtr,"On",TAG_END);
- } else {
- GO_SetObjAttrs(go,AUTOSCROLL_ID,0, GODT_BodyTextPtr,"Off",TAG_END);
- }
-
- GO_SetObjAttrs(go,FONTNAME_ID,0, GODT_BodyTextPtr,&gl->font_text[0],TAG_END);
- if(scrn->Font) {
- GO_SetObjAttrs(go,FONTSIZE_ID,0, GTNM_Number,scrn->Font->ta_YSize,TAG_END);
- }
-
- if( !GO_OpenWindow(go,
- WA_CustomScreen, par_go->go_Screen,
- TAG_END) ) {
- DestroyExamine(go);
- return NULL;
- }
-
- return go;
- }
-